<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function Dog(name,sex){
            this.name = name,
            this.sex = sex
        }

        // 都会叫，方法写在原型上
        Dog.prototype.cry = function(){
            console.log('wo wo !!');
        }

        // 两个狗
        let dog1 = new Dog ('小黑','公')
        dog1.cry()

        let dog2 = new Dog ('小白','公')
        setInterval(()=>{
            dog2.cry()
        },2000)
    </script>
</body>
</html>